using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Diagnostics;
using System.Windows.Forms;

namespace Janus.NorthwindDemo2007
{
	public partial class CustomerDataControl
	{


		protected override void OnDataSourceChanged()
		{
			this.AddBinding(this.editCompanyName, "Text", "Customers.CompanyName");
			this.AddBinding(this.editContactName, "Text", "Customers.ContactName");
			this.AddBinding(this.editContactTitle, "Text", "Customers.ContactTitle");
			this.AddBinding(this.editCustomerId, "Text", "Customers.CustomerID");
			this.AddBinding(this.editAddress, "Text", "Customers.Address");
			this.AddBinding(this.editCity, "Text", "Customers.City");
			this.AddBinding(this.editCountry, "Text", "Customers.Country");
			this.AddBinding(this.editFax, "Text", "Customers.Fax");
			this.AddBinding(this.editPhone, "Text", "Customers.Phone");
			this.AddBinding(this.editPostalCode, "Text", "Customers.PostalCode");
			this.AddBinding(this.editRegion, "Text", "Customers.Region");

		}

		protected override void OnAllowEditChanged()
		{
			this.editCustomerId.ReadOnly = (! this.AllowEdit) | (! this.IsAddNew);

			this.editCompanyName.ReadOnly = ! this.AllowEdit;
			this.editContactName.ReadOnly = ! this.AllowEdit;
			this.editContactTitle.ReadOnly = ! this.AllowEdit;
			this.editAddress.ReadOnly = ! this.AllowEdit;
			this.editCity.ReadOnly = ! this.AllowEdit;
			this.editCountry.ReadOnly = ! this.AllowEdit;
			this.editFax.ReadOnly = ! this.AllowEdit;
			this.editPhone.ReadOnly = ! this.AllowEdit;
			this.editPostalCode.ReadOnly = ! this.AllowEdit;
			this.editRegion.ReadOnly = ! this.AllowEdit;
		}

		protected override void OnIsAddNewChanged()
		{
			this.editCustomerId.ReadOnly = ! this.IsAddNew;
		}

		public override Size FullSize
		{
			get
			{
				return new System.Drawing.Size(572, 240);
			}
		}

		protected override void OnUseTabBackgroundChanged()
		{
			if (this.UseTabBackground)
			{
				this.gbBackground.BackgroundStyle = Windows.EditControls.BackgroundStyle.TabPage;
			}
			else
			{
				this.gbBackground.BackgroundStyle = Windows.EditControls.BackgroundStyle.Panel;
			}
		}
	}

} //end of root namespace